#include <stdio.h>
#include <string.h>
#include <malloc.h>

#include "list.h"

struct student {
    int num;
    struct list_head list;
};

int main(void)
{
    struct student *fuck;
    struct list_head head, list, *pos, *scan_list;

    init_list_head(&head);

    struct student *stu1 = (struct student*)malloc(sizeof(struct student));
    struct student *stu2 = (struct student*)malloc(sizeof(struct student));

    stu1->num = 3;
    stu2->num = 4;

    list_add_tail(&stu1->list, &head);
    list_add_tail(&stu2->list, &head);

    /* list_for_each(pos, &head) {
        scan_list = list_entry(pos, struct student, list);
        printf("Nodedata: %d\n", scan_list->num);
    } */

    scan_list = head.next;
    fuck = list_entry(&(scan_list->next->next), struct student, list);
    //scan_list = list_entry(&(stu1->list.next), struct student, list);

    printf("%d\n", fuck->num);

    return 0;
}